const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    cl_x:"",
    gz_sq:"",
    hktupian:[],
    img_arr: '',
    page:0,
    zd_h:"",
    zd_lh:"",
    sh_name:"",
    sh_h:"",
    yy_dz:"",
    lx_r:"",
    lx_dh:"",
    detailList:''
  },  

  previewImage(e) {
    var that = this;
    var cur = e.target.dataset.src; //获取本地一张图片链接
    ////console.log(cur)
    wx.previewImage({
      current: cur, //字符串，默认显示urls的第一张
      urls: [cur] // 数组，需要预览的图片链接列表
    })

  },
  guanbi:function(e){
    console.log(e)
    var id = e.currentTarget.dataset.id;
    var that = this;
    
    // app.globalData.file_12 = app.globalData.file_12.splice(id,1);
    for(var i = 0;i<app.globalData.file_12.length;i++){
      if(id==app.globalData.file_12[i]['id']){
        console.log(i)
        that.data.hktupian.splice(i,1);
        wx.showToast({
          title: '删除成功！',
          icon: 'none',
          duration: 1000
        })
      }
    }
    app.globalData.file_12 = that.data.hktupian
    console.log(app.globalData.file_12)
            that.setData({
              img_arr:app.globalData.file_12,
              hktupian:app.globalData.file_12
            })
    
    
        if(this.data.img_arr.length==1){
          this.setData({
            gao: 110 
          })
       } else if (this.data.img_arr.length == 2) {
         this.setData({
           gao: 110
         })
       }
       else if (this.data.img_arr.length == 3) {
         this.setData({
           gao: 220
         })
       }
       else if (this.data.img_arr.length == 4) {
         this.setData({
           gao: 220
         })
       }
       else if (this.data.img_arr.length == 5) {
         
         this.setData({
           gao: 220
         })
       }
       else if (this.data.img_arr.length == 6) {
        
         this.setData({
           gao: 220
         })
       }
       else if (this.data.img_arr.length == 7) {
         
         this.setData({
           gao:330
         })
       }
       else if (this.data.img_arr.length == 8) {
        
         this.setData({
           gao: 330
         })
       }
       else if (this.data.img_arr.length == 9) {
        
         this.setData({
           gao: 330
         })
       }
       else if (this.data.img_arr.length == 10) {
        
         this.setData({
           gao: 440
         })
       }
     
    
  },
  cl_x:function(e){
    console.log(e)
    this.data.cl_x = e.target.dataset.id
  },
  gz_sq:function(e){
    console.log(e)
    this.data.gz_sq = e.target.dataset.id
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    wx.request({
      url: app.globalData.url_l + 'applets/serviceDetails?customer_id=' + options.customer_id,
      method:'GET',
      header:{
        'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
        'token':wx.getStorageSync('token')
      },
      success(res){
        console.log(res.data.data)
        that.setData({
          detailList:res.data.data,
          cl_x:res.data.data.type,
          gz_sq:res.data.data.applyType
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})